package software.hust.com.hust_last.callback;

import com.google.gson.internal.$Gson$Types;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class ObjectCallback<T> implements IResponseCallback {
    private Type mType;

    public ObjectCallback() {
        Type clsType = getClass().getGenericSuperclass();
        if (clsType instanceof Class) {
            throw new RuntimeException("Missing type parameter!");
        }
        ParameterizedType paramType = (ParameterizedType) clsType;
        mType = $Gson$Types.canonicalize(paramType.getActualTypeArguments()[0]);
    }

    public Type getType() {
        return mType;
    }

    public abstract void onSuccess(int responseCode, T response);
}
